package com.jinhe.yyds.controller;

import com.jinhe.yyds.req.EbookQueryReq;
import com.jinhe.yyds.req.EbookSaveReq;
import com.jinhe.yyds.resp.CommonResp;
import com.jinhe.yyds.resp.EbookResp;
import com.jinhe.yyds.resp.PageResp;
import com.jinhe.yyds.service.EbookService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController  // 返回字符串
@RequestMapping("/ebook")
public class EbookController {



    @Resource
    private EbookService ebookService;

    @GetMapping ("/list")
    public CommonResp list(EbookQueryReq req) {
        CommonResp<PageResp<EbookResp>> resp = new CommonResp<>();
        PageResp<EbookResp> list = ebookService.list(req);
        resp.setContent(list);
        return resp;
    }
    @GetMapping ("/save")
    public CommonResp save(EbookSaveReq req) {
        CommonResp resp = new CommonResp<>();
        ebookService.save(req);
        return resp;
    }

}
